package com.yirui.bridge.udp.parser;

import com.yirui.bridge.udp.DataParser;
import io.netty.buffer.ByteBuf;

import java.util.Map;

/**
 * @author Dujie
 * @create 2021/11/25
 * @since 1.0.0
 */
public class ItemFCParser implements DataParser {

    @Override
    public Object parse(ByteBuf buffer, int itemIndex, Map container) {
        float val = buffer.getByte(6)/100.0f;
        if(buffer.getByte(5) == 0xFF){
            return  -val;
        }else{
            return val;
        }

    }

    @Override
    public boolean isSingleValue() {
        return true;
    }
}
